package com.org.platform.support.error;

import org.springframework.boot.web.server.ErrorPage;
import org.springframework.boot.web.server.ErrorPageRegistrar;
import org.springframework.boot.web.server.ErrorPageRegistry;
import org.springframework.http.HttpStatus;

public class MyErrorPageRegistrar implements ErrorPageRegistrar {

  @Override
  public void registerErrorPages(ErrorPageRegistry registry) {
    registry.addErrorPages(new ErrorPage(HttpStatus.BAD_REQUEST, "/error/400"));
    registry.addErrorPages(new ErrorPage(HttpStatus.UNAUTHORIZED,"/error/401"));
    registry.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/error/404"));
    registry.addErrorPages(new ErrorPage(HttpStatus.INTERNAL_SERVER_ERROR, "/error/500"));
  }
}
